package liangtWorkSpace.suanfa;

import java.util.Arrays;

/**
 * 冒泡排序
 */
public class MaoPaoSort {
    /**
     * 排序
     * @param arrs
     */
    private static void sort(int[] arrs) {
        for (int i = 0; i < arrs.length; i++){
            for (int j = i; j < arrs.length; j++) {
                if (arrs[i] > arrs[j]){
                    SortUtils.swap(i,j,arrs);
                }
            }
        }
    }
    public static void main(String[] args) {
        int[] arrs1 = SortUtils.getArrays(10);
        int[] arrs2 = new int[arrs1.length];
        System.arraycopy(arrs1,0,arrs2,0,arrs1.length);
        SortUtils.print(arrs1);
        System.out.println();
        // sort
        sort(arrs1);
        Arrays.sort(arrs2);
        SortUtils.print(arrs1);
        System.out.println();
        System.out.println(SortUtils.check(arrs1,arrs2));
    }
}
